package com.cloudlead.customerAction.action;

import com.cloudlead.common.lang.BusinessModule;
import com.cloudlead.common.lang.annotation.Label;
import com.cloudlead.common.lang.persistence.EasyuiGridData;
import com.cloudlead.common.lang.persistence.Page;
import com.cloudlead.common.worker.action.impl.AbstractActionFactory;
import com.cloudlead.common.worker.annotation.Action;
import com.cloudlead.common.worker.annotation.Order;
import com.cloudlead.customerAction.BusinessModules;
import com.cloudlead.customerAction.service.CustomerOrdeFindSer;
import com.cloudlead.customerService.CustomerOrderFindService;
import com.cloudlead.customerService.vo.CreateCustmoerOrderVo;
import com.cloudlead.customerService.vo.CustmoerOrderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.validation.constraints.NotNull;

/**
 * Created by 123 on 2015/8/31.
 */
@Controller
public class CustomerOrderFindActionFactory extends AbstractActionFactory implements CustomerOrderFindService {


    public CustomerOrderFindActionFactory() {
        super(BusinessModules.CustomerOrderFind);
    }
    @Autowired
    public CustomerOrdeFindSer customerOrdeFindSer;

    @Action
    @Order(1)
    @Label("订单分页查询")
    public EasyuiGridData customerOrderList(@Label("订单信息")CustmoerOrderVo vo,@Label("页数")int page,@Label("条数") int rows) {
        return new EasyuiGridData(customerOrdeFindSer.CustomerOrderFind(vo,rows,page),
                "id,bussinessCode,commodity,polName,delName,quantity,totalPrice,orderTime," +
                        "baseVoya.vessel vessel,baseVoya.voyage voyage," +
                        "baseVoya.arriveExpectedTime arriveExpectedTime," +
                        "baseVoya.arriveTime arriveTime," +
                        "baseVoya.startExpectedTime startExpectedTime," +
                        "belongForward.companyShortName companyShortName," +
                        "baseVoya.startTime startTime"
        );
    }

    @Override
    @Action
    @Order(2)
    @Label("通过ID单值查询")
    public Object customerOrderFindId(@NotNull @Label("ID")String id) {
        return customerOrdeFindSer.CustomerOrderFindId(id);
    }

    @Override
    @Action
    @Order(3)
    @Label("修改货主订单箱量")
    public String editQuantity(String id,@Label("页数")int page) {
        return customerOrdeFindSer.updateQuantity(id,page);
    }

    @Override
    @Action
    @Order(4)
    @Label("修改车队订单箱量")
    public String editQuantityByFleet(String id,@Label("页数")int page) {
        return customerOrdeFindSer.updateQuantityByFleet(id,page);
    }



}
